<template>
    <view>
        <view class="goodsTitle">
            <!-- 漂流商品 -->
            <image src="~@/static/images/aau.png"  mode="widthFix"></image>
            为您推荐
            <image src="~@/static/images/aau.png"  mode="widthFix"></image>
        </view>
        <view class="goodsList">
        
		<view class="goodsList-li" v-for="(item,index) in dataList" :key="index" @click="$u.func.route('/pages/goods/goods?id='+item.id)">
                <image :src="item.fileUrl" class="goodsList-li-img" ></image>
                <view class="goodsList-li-title">
                {{ item.title }}
                </view>
                <view class="goodsList-li-price">
                    ￥ {{ item.price }} <span>0元起租</span>
                </view>
            </view>
            
        </view>
    </view>
	
</template>

<script>
	export default {
		data() {
			return {
                dataList:[]
            }
        },
        mounted() {
            this.getGoodListData()
        },
        methods:{
            getGoodListData() {
                this.$u.api
                .getGoodList()
                .then((res) => {
                console.log(res);
                this.dataList=res.data.records
                })
                .catch(() => {
                });
            },
        }
	}
</script>

<style lang="scss" scoped>
.goodsTitle{
    margin: 30rpx 30rpx 20rpx 30rpx;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 34rpx;
    font-weight: bold;
    image{
        width: 110rpx;
        height: 50rpx;
        margin: 0 20rpx;
    }
}
// .goodsTitle::after{
//     content: '';
//     width: 50rpx;
//     height: 6rpx;
//     border-radius: 20rpx;
//     background: #e54d42;
//     position: absolute;
//     bottom: -15rpx;
//     left: 50%;
//     margin-left: -25rpx;
// }
	.goodsList{
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        margin: 30rpx 20rpx;
        &-li{
            margin: 10rpx;
            background: #fff;
            border-radius: 10rpx;
            overflow: hidden;
            &-price{
                padding: 0 20rpx 40rpx 20rpx;
                font-size: 32rpx;
                color: #e54d42;
                span{
                    color: #999;
                    font-size: 24rpx;
                    // text-decoration: line-through;
                    margin-left: 20rpx;
                }
            }
            &-title{
                min-height: 120rpx;
                padding: 20rpx;
            }
            &-img{
                width: 100%;
                height: 220px;
            }
        }
    }
</style>
